<template>
  <el-config-provider :locale="store.state.locale">
    <keep-alive>
      <transition name="fade" mode="out-in">
        <router-view />
      </transition>
    </keep-alive>
      <weather/>
  </el-config-provider>
</template>
<script setup>
import {ref,watch} from 'vue'
import { useStore} from "vuex";
import { useRouter, useRoute } from "vue-router";

const router = useRouter();
const route = useRoute();

const store = useStore();
const whitePath = ["/login", "/index", "/", "/404"];

watch(
  route,
  (to, from) => {
    if (to.path == "/login") {
      document.querySelector("canvas")
        ? document.querySelector("canvas").remove()
        : "";
      document.getElementById("app").style = "";
    }
    if (whitePath.indexOf(to.path) === -1) {
      let obj = {
        name: to.name,
        path: to.path,
        icon: sessionStorage.getItem("currentIcon"),
      };
      store.commit("ADD_TABS", obj);
    }
  },
  { deep: true, immediate: true }
);
</script>
<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  overflow: hidden;
}
.all-button{
  display: flex; width: 100%; justify-content: space-between;
  .left-button{
    display: flex
  }
}
.top-right-btn {
    position: relative;
    float: right;
}
nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
iframe {
  display: none;
}
#app .wrap-cls {
  width: 200px !important;
  height: 100vh;
  background: #545c64;
  overflow-x: hidden;
}
#app .wrap-cls1 {
  width: auto;
  height: 100vh;
  background: #545c64;
}
#app .el-container {
  flex-basis: 0%;
}
.app-container {
  padding: 20px;
  box-sizing: border-box;
  height: calc(100% - 45px);
  overflow-y: auto;
  width:calc(100% - 50px);
  .header {
    margin-bottom: 20px;
  }
}
</style>
